home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / viewkit / xcontact / lib / OkTStructArray.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  2.0 KB  |  62 lines

  1. /*
  2.  * Copyright (C) 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. ///////////////////////////////////////////////////////////////////////////
  18. // OkTStructArray.h --
  19. //
  20. // Use this class for struct object only.
  21. // OkTStructArray will not call constructor and destructor of the elements.
  22. ///////////////////////////////////////////////////////////////////////////
  23. #pragma once
  24. #include "OkArray.h"
  25.  
  26.  
  27. template <class Type>
  28. class OkTStructArray : public OkArray {
  29.  
  30.  public:
  31.   OkTStructArray();
  32.   OkTStructArray( u_int size );
  33.   OkTStructArray( OkTStructArray<Type>& );
  34.   virtual ~OkTStructArray();
  35.   virtual char *className() { return "OkTStructArray"; }
  36.  
  37.   void operator=( OkTStructArray<Type>& );
  38.   Type& operator[](u_int index);
  39.   void append(Type & item);
  40.   void append(OkTStructArray<Type> &);
  41.   void remove(u_int start, u_int length=1);
  42.   void removeAll();
  43.   void insert(OkTStructArray<Type> & a, u_int p);
  44.   void insert(Type & item, u_int p);
  45.  
  46.   int find(Type& x, u_int start=0);
  47.  
  48.   OkTStructArray<Type> cut(u_int start, u_int len=1);
  49.   OkTStructArray<Type> extract(u_int start, u_int len);
  50.   OkTStructArray<Type> head(u_int len=1);
  51.   OkTStructArray<Type> tail(u_int len=1);
  52.  
  53.  protected:
  54.   OkTStructArray(u_int esize, u_int num, void * data);
  55.  
  56.   virtual int compareElements( Type, Type );
  57.   virtual void destroyElements(void * , u_int );
  58.  
  59.  private:
  60.   int compareElements( void*, void* );
  61. };
  62.